<template>
  <van-tabbar v-model="active" route active-color="#fc6627">
    <!-- 首页 -->
    <van-tabbar-item to="/">
      <span>首页</span>
      <template v-slot:icon="{ active }">
        <GeekIcon v-if="active" name="home-sel"></GeekIcon>
        <GeekIcon v-else name="home"></GeekIcon>
      </template>
    </van-tabbar-item>
    <!-- 问答 -->
    <van-tabbar-item to="/question">
      <span>问答</span>
      <template #icon="{active}">
        <GeekIcon v-if="active" name="qa-sel"></GeekIcon>
        <GeekIcon v-else name="qa"></GeekIcon>
      </template>
    </van-tabbar-item>
    <!-- 视频详情 -->
    <van-tabbar-item to="/video">
      <span>视频详情</span>
      <template #icon="{active}">
        <GeekIcon v-if="active" name="video-sel"></GeekIcon>
        <GeekIcon v-else name="video"></GeekIcon>
      </template>
    </van-tabbar-item>
    <!-- 用户 -->
    <van-tabbar-item to="/user">
      <span>用户</span>
      <template #icon="{active}">
        <GeekIcon v-if="active" name="mine-sel"></GeekIcon>
        <GeekIcon v-else name="mine"></GeekIcon>
      </template>
    </van-tabbar-item>
  </van-tabbar>
</template>

<script>
import GeekIcon from '@/components/geek-icon.vue'
export default {
  name: 'AppTabbar',
  components: {
    GeekIcon
  },
  data () {
    return {
      active: 0
    }
  }
}
</script>

<style scoped lang="less">
.van-tabbar {
  background: #F7F8FA;
  position: static;
}
::v-deep .van-tabbar-item--active {
  color: #FC6627;
  background-color: #F7F8FA
}
::v-deep .van-tabbar-item__icon {
  font-size: 20px;
}
::v-deep .van-tabbar-item__text {
  font-size: 10px;
}
</style>
